<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">

    </div>
</body>
<script>
    //使用Object创建对象
    let stu=new Object()
    //声明属性
    stu.name="tom"
    stu.id = 1
  stu.age = 20
  stu.gender = '男'
  //声明函数
  stu.toString=function(){
      return `{"id":"${this.id}","name":"${this.name}","age":"${this.age}","gender":"${this.gender}"}`
  }
  let info = stu.toString()
  app.innerHTML = info
</script>
</html>